package game.util;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;

/**
 * GRAPHICS (Singleton)
 */
public class TileGraphics {
   
   private SpriteSheet sheet;
   private Image wall;
   private Image floor;
   private Image greenSprite;
   private Image blueSprite;
   private Image yellowSprite;
   private Image redSprite;
   private Image[] charSprites;
   private Image exit;
   private Image greenPortrait;
   private Image bluePortrait;
   private Image yellowPortrait;
   private Image redPortrait;
   private Image[] charPortraits;
   
   public TileGraphics() {
      Image img;
      try {
         img = new Image("assets/lofisheet.png");
         sheet = new SpriteSheet(img, 24, 24);
         wall = sheet.getSubImage(0, 0);
         floor = sheet.getSubImage(1, 0);
         exit = sheet.getSubImage(2, 0);
         greenSprite = sheet.getSubImage(3, 0);
         blueSprite = sheet.getSubImage(4, 0);
         yellowSprite = sheet.getSubImage(5, 0);
         redSprite = sheet.getSubImage(6, 0);
         charSprites = new Image[] {greenSprite, blueSprite, yellowSprite, redSprite};
         greenPortrait = sheet.getSubImage(3, 1);
         bluePortrait = sheet.getSubImage(4, 1);
         yellowPortrait = sheet.getSubImage(5, 1);
         redPortrait = sheet.getSubImage(6, 1);
         charPortraits = new Image[] {greenPortrait, bluePortrait, yellowPortrait, redPortrait};
      } catch (SlickException e) { }

   }
   
   private static final TileGraphics INSTANCE = new TileGraphics();
   
   public static TileGraphics gfx() {
      return INSTANCE;
   }

   public SpriteSheet getSheet() {
      return sheet;
   }

   public Image getWall() {
      return wall;
   }

   public Image getFloor() {
      return floor;
   }

   public Image getGreenSprite() {
      return greenSprite;
   }

   public Image getBlueSprite() {
      return blueSprite;
   }

   public Image getYellowSprite() {
      return yellowSprite;
   }

   public Image getRedSprite() {
      return redSprite;
   }

   public Image[] getCharSprites() {
      return charSprites;
   }

   public Image getExit() {
      return exit;
   }

   public Image getGreenPortrait() {
      return greenPortrait;
   }

   public Image getBluePortrait() {
      return bluePortrait;
   }

   public Image getYellowPortrait() {
      return yellowPortrait;
   }

   public Image getRedPortrait() {
      return redPortrait;
   }

   public Image[] getCharPortraits() {
      return charPortraits;
   }
   
}
